import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

public class TrafficLightComponent extends JComponent
{
   public void paintComponent(Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;
      g2.setColor(Color.RED);
      g2.fillRoundRect(10,10,40,40,50,50);
      g2.setColor(Color.YELLOW);
      g2.fillRoundRect(10,60,40,40,50,50);
      g2.setColor(Color.GREEN);
      g2.fillRoundRect(10,110,40,40,50,50);
   }
}